package com.itheima.demo4;

import java.io.File;
import java.io.IOException;

public class FileDemo5 {
    public static void main(String[] args) throws IOException {

        File file = new File("aaa");
        delet(file);


    }

    public static void delet(File file){
        File[] files = file.listFiles();
        if (files != null){
            for (File file1 : files) {
                if (file1.isFile()){
                    file1.delete();
                }else {
                    delet(file1);
                }
            }
            //最后还要删除自己
            file.delete();
        }
    }

}
